package com.yulan.xunfei;


import org.junit.Test;

import java.util.Scanner;

public class test3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {// 注意，如果输入是多个测试用例，请通过while循环处理多个测试用例
            int[] arr = new int[8];
            for(int i=0; i<8; i++){
                arr[i] = in.nextInt();
            }
            System.out.println(isSlice(arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6],arr[7]));

        }
    }

    public static int isSlice(int x1,int y1, int x2, int y2, int x3, int y3, int x4, int y4){
        if(y4 < y1 || y3 > y2 || x4 < x1 || x3 > x2) return 0;
        else if(y4 < y2 && y3 > y1 && x4 < x2 && x3 > x1) return 0;
        else if(y2 < y4 && y1 > y3 && x2 < x4 && x1 > x3) return 0;
        else return 1;
    }

    @Test
    public void test(){

    }
}
